<template>
  <div class="ai-basic">
    <div class="session-list-basic session-list-basic-width" @click="dialogueInfoBottom"></div>

    <div class="dialogue-basic dialogue-basic-width">
      <div class="dialogue-info" ref="dialogueInfoRef">
        <div class="body">
        </div>
      </div>

      <div class="dialogue-input">
        <div class="left"></div>
        <div class="center">
          <textarea title="textarea" ref="textareaRef" placeholder="请输入问题~" v-model="question"></textarea>
        </div>
        <div class="right"></div>
      </div>
    </div>

    <div class="describe-basic describe-basic-width"></div>
  </div>
</template>
<script setup>
import {onMounted, ref, watch} from "vue";

let question = ref('');

let textareaRef = ref(null);

let dialogueInfoRef = ref(null);

onMounted(() => {
  textareaRef.value.addEventListener('input', (e) => {
    textareaRef.value.style.height = '24px';
    textareaRef.value.style.height = e.target.scrollHeight + 'px';
  });
});




</script>
<style scoped>
.ai-basic {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: space-between;
}

.session-list-basic {
  height: 100vh;
  background-color: rgb(243, 244, 246);
  border-right: 1px solid rgb(224, 225, 227);
}

.dialogue-basic {
  margin-left: 10vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.describe-basic {
  height: 100vh;
}

.dialogue-info {
  width: 100%;
  height: calc(100vh - 20px);
  margin-bottom: 20px;
  overflow: scroll;
  background-color: #59c3ef;
  
}
.text {
  width: 500px;
  height: 20px;
  background-color: red;
}
.dialogue-info .body {
  width: 100%;
  height: max-content;
}

.dialogue-input {
  width: calc(100% - 24px);
  padding: 8px 12px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  border: 1px solid rgb(222, 222, 222);
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: 0 12px 30px 2px rgb(0, 0, 0, .2);
}
.dialogue-input .left, .dialogue-input .right {
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialogue-input .right {
  border-radius: 50%;
  background-color: rgb(220, 220, 220);
}
.dialogue-input .center {
  width: calc(100% - 104px);
  height: max-content;
}
.dialogue-input .center textarea {
  width: 100%;
  resize: none;
  outline: none;
  border: none;
  height: 24px;
  font-size: 18px;
  color: rgb(0, 0, 0);
  margin: 9px 0 7px 0;
  display: flex;
  align-items: center;
}
.dialogue-input .center textarea::-webkit-input-placeholder {
  color: rgb(198, 198, 198);
}

/* 当屏幕宽度小于 1601 时 */
@media (max-width: 1601px) {
  .session-list-basic-width {
    width: 240px;
  }

  .dialogue-basic-width {
    width: 800px;
  }

  .describe-basic-width {
    width: 100px;
  }
}

/* 当屏幕宽度大于 1600 时 */
@media (min-width: 1600px) {
  .session-list-basic-width {
    width: 320px;
  }
  .dialogue-basic-width {
    width: 1000px;
  }

  .describe-basic-width {
    width: 160px;
  }
}

</style>